//
//  ZBFourHeaderCell.m
//  BaseRACDemo
//
//  Created by 庄波 on 2018/3/22.
//  Copyright © 2018年 庄波. All rights reserved.
//

#import "ZBFourHeaderCell.h"
#import "ZBFourHeadrItemViewModel.h"

@interface ZBFourHeaderCell()
@property (nonatomic,strong) ZBFourHeadrItemViewModel *viewModel;
@end

@implementation ZBFourHeaderCell

+ (instancetype)cellWithTableView:(UITableView *)tableView{
    static NSString *ID = @"ProfileHeaderCell";
    ZBFourHeaderCell *cell = [tableView dequeueReusableCellWithIdentifier:ID];
    if (!cell) cell = [self mh_viewFromXib];
    return cell;
}

- (void)bindViewModel:(ZBFourHeadrItemViewModel *)viewModel{
    self.viewModel = viewModel;
}


- (void)setIndexPath:(NSIndexPath *)indexPath rowsInSection:(NSInteger)rows{};

- (void)awakeFromNib {
    [super awakeFromNib];
    
    self.contentView.backgroundColor = [UIColor whiteColor];
    
    /// 绑定数据 因为用户的数据可能随时改变的
    RAC(self.labName , text) = RACObserve(self, viewModel.user.screenName);
    RAC(self.phone, text) = RACObserve(self, viewModel.user.phone);
    RAC(self.sign,text) = RACObserve(self, viewModel.user.featureSignature);
//    [[[[RACObserve(self, viewModel.user.profileImageUrl) ignore:nil] distinctUntilChanged] deliverOnMainThread] subscribeNext:^(NSURL * avatarUrl) {
//        [self.avatarView yy_setImageWithURL:avatarUrl placeholder:MHWebAvatarImagePlaceholder() options:MHWebImageOptionAutomatic completion:NULL];
//    }];
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
